home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / CON-03A.ZIP / UEDITOR.PAS < prev    next >
Pascal/Delphi Source File  |  1995-09-01  |  5KB  |  207 lines

  1. (* Groovy(tm) User Editor o.1α                                            *)
  2. unit ueditor;
  3.  
  4. interface
  5.  
  6. procedure init_ansi;
  7. procedure init;
  8. procedure next_u;
  9. procedure previous_u;
  10. procedure list_all;
  11. procedure edit_user;
  12. procedure exit;
  13. procedure menu;
  14. procedure run_usered;
  15.  
  16. implementation
  17.  
  18. uses crt,
  19.      editor;
  20. Const
  21.   filename = 'data\users.dat';
  22.   Maxmembers = 10;
  23. type
  24.   userrecord = record
  25.     handle             : string[30];
  26.     location           : string[30];
  27.     realname           : string[30];
  28.     password           : string[15];
  29.     voicephone         : string[30];
  30.     dataphone          : string[30];
  31.     lines              : byte;
  32.     computer           : string[30];
  33.   end;
  34.  
  35. var i :integer;
  36.     user : userrecord;
  37.     choice : char;
  38.     cows_come_home :boolean;
  39.     users: file of userrecord;
  40.     alldone : boolean;
  41.  
  42. procedure init_ansi;
  43. begin
  44.   clrscr;
  45.   write_picture('editor');
  46. end;
  47.  
  48.  
  49. procedure init;
  50. begin
  51.   assign(users,filename);
  52.   reset(users);
  53. end;
  54.  
  55. procedure next_u;
  56. begin
  57.   if not eof(users) then begin
  58.    read(users,user);
  59.    gotoxy(19,3);
  60.    write(user.handle+'                  ');
  61.    gotoxy(19,4);
  62.    write(user.password+'    ');
  63.    gotoxy(19,5);
  64.    write(user.voicephone+'       ');
  65.    gotoxy(19,6);
  66.    write(user.location+'      ');
  67.   end;
  68. end;
  69.  
  70. procedure previous_u;
  71. begin
  72.    if not eof(users) then begin
  73.    read(users,user);
  74.    gotoxy(19,3);
  75.    write(user.handle+'                   ');
  76. {   gotoxy(19,4);
  77.    write(user.password+'    ');
  78.    gotoxy(19,5);
  79.    write(user.phone+'       ');
  80.    gotoxy(19,6);
  81.    write(user.access,'      ');}
  82.   end;
  83. end;
  84.  
  85. procedure list_all;
  86. var num : integer;
  87.     ch : char;
  88. begin
  89.   textcolor(15);
  90.   clrscr;
  91.   writeln('    ■ Groovey Express User Listing ■ v0.01 Beta ■ (c)1995 Grooven Designs ■');
  92.   writeln;
  93.   reset(users);
  94.   num:=0;
  95.   repeat
  96.    inc(num);
  97.    if not eof(users) then begin
  98.     read(users,user);
  99.     write(num,') ');
  100.     writeln(user.handle);
  101.    end;
  102.   until eof(users);
  103.   writeln;
  104.   writeln('                      Press any key to go back to the editor...');
  105.   ch:=readkey;
  106.   init_ansi;
  107.   init;
  108.   next_u;
  109. end;
  110.  
  111. procedure edit_user;
  112. begin
  113.   gotoxy(4,12);
  114.   writeln('(H) Handle, (P) Password, (#) Phone Number, (A) Access Level');
  115.   choice := readkey;
  116.   if (choice = 'H') or (choice ='h') then
  117.     begin
  118.       gotoxy(4,14);
  119.       writeln('Please Enter NEW Name User Name');
  120.       gotoxy(19,3);
  121.       readln(user.handle);
  122.       filemode :=2;
  123.       write(users,user);
  124.       gotoxy(4,14);
  125.       writeln('                               ');
  126.     end;
  127. {  if (choice = 'P') or (choice ='p') then
  128.     begin
  129.       gotoxy(4,14);
  130.       writeln('Please Enter NEW Password');
  131.       gotoxy(19,4);
  132.       readln(user.password);
  133.       filemode :=2;
  134.       write(users,user);
  135.       gotoxy(4,14);
  136.       writeln('                               ');
  137.     end;
  138.   if (choice = '#') then
  139.     begin
  140.       gotoxy(4,14);
  141.       writeln('Please Enter NEW Phone Number');
  142.       gotoxy(19,5);
  143.       readln(user.phone);
  144.       filemode :=2;
  145.       write(users,user);
  146.       gotoxy(4,14);
  147.       writeln('                               ');
  148.     end;
  149.   if (choice = 'a') or (choice = 'A') then
  150.     begin
  151.       gotoxy(4,14);
  152.       writeln('Please Enter NEW Access Level');
  153.       gotoxy(19,6);
  154.       readln(user.access);
  155.       filemode :=2;
  156.       write(users,user);
  157.       gotoxy(4,14);
  158.       writeln('                               ');
  159.     end;}
  160. end;
  161.  
  162. procedure exit;
  163. begin
  164.   halt(0)
  165. end;
  166.  
  167. procedure menu;
  168. (* Menu selection for different usereditor option - NEEDS WORK BADLY *)
  169. (* Make light bar selector *)
  170. begin
  171.   next_u;
  172.   gotoxy(4,12);
  173.   write('(+) Next User, (-) Previous User, (E) Edit User, (L) List Users');
  174.   repeat
  175.     choice:=readkey;
  176.     if (choice = '+')
  177.       then next_u else
  178.     if (choice = '-')
  179.       then previous_u else
  180.     if (choice = 'a') or (choice = 'A')
  181.       then list_all else
  182.     if (choice = 'e') or (choice = 'E')
  183.       then edit_user else
  184.     if (choice = 'l') or (choice = 'L')
  185.       then list_all else
  186.     if (choice = 'Q') or (choice = 'q')
  187.       then
  188.         begin
  189.           clrscr;
  190.           writeln('                   Thanks for choosing Groovey Express');
  191.           cows_come_home := true
  192.         end;
  193.     until cows_come_home
  194. end;
  195.  
  196. (* Main body of the User Editor *)
  197.  
  198. procedure run_usered;
  199. begin
  200.   init_ansi;
  201.   (*locate_user_file;*)
  202.   init;
  203.   menu;
  204. end;
  205. end.
  206.  
  207.